﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ProjetCom.Ctrl;
using ProjetCom.Model.Template;

namespace ProjetCom.Vue
{
    class LevelPong : Level
    {
        // Texture
        private Dictionary<string, Texture2D> m_BlockSheets;
        public LevelPong(IServiceProvider p_serviceProvider, CtrlPong p_ctrl)
            : base(p_serviceProvider, p_ctrl)
        {
            // load the textures
            m_BlockSheets = new Dictionary<string, Texture2D>();
            m_BlockSheets.Add("BarreLeft", Content.Load<Texture2D>("Sprites/Pong/barreLeft"));
            m_BlockSheets.Add("BarreRight", Content.Load<Texture2D>("Sprites/Pong/barreRight"));
            m_BlockSheets.Add("Balle", Content.Load<Texture2D>("Sprites/Pong/balle"));

            ColorBackground = Color.Black;
        }

      
        /// <summary>
        /// Dessine
        /// </summary>
        /// <param name="_gameTime"></param>
        /// <param name="p_spriteBatch"></param>
        override public void Draw(SpriteBatch p_spriteBatch)
        {
            foreach (Element element in ((CtrlPong)m_Ctrl).Elements)
            {
                p_spriteBatch.Draw(m_BlockSheets[element.Name], element.Rectangle, Color.White);
            }
            DrawScore(p_spriteBatch);
        }



        public override void Dispose()
        {
        }
    }
}
